package com.weiyu.bultrasound.core.service.Impl;

import com.weiyu.bultrasound.core.service.AsyncService;
import com.weiyu.bultrasound.core.service.FilesUploadService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 *@description 异步任务处理
 *@author abner chow
 *@date 2019-08-28 10:27
 */
@Service
public class AsyncServiceImpl implements AsyncService {

    @Autowired
    FilesUploadService filesUploadService;

    private static final Logger logger = LoggerFactory.getLogger(FilesUploadServiceImpl.class);

    @Async("asyncServiceExecutor")
    @Override
    public void asynFilesToFtp(Long id) {
        logger.info("申请单id：" + id + " 开启异步任务，同步文件到移动ftp服务器");
        Boolean result = filesUploadService.synFilesToFtp(id);
        logger.info("申请单id：" + id + " 的同步文件的异步任务执行结束，执行结果：" + result);

    }
}
